import request from '@/utils/request';
import Qs from 'qs';

/**
 * 影片列表
 */
export function movie(params) {
  return request.get(`/platform/movie?${Qs.stringify(params)}`);
}

/**
 * 影片详情
 */
export function movieDetial(movieId) {
  return request.get(`/platform/movie/${movieId}`);
}

/**
 * 修改影片信息
 */
export function movieEdit(movieId, data) {
  return request.post(`/platform/movie/${movieId}`, data);
}

/**
 * 影片在指定品牌下的排片信息
 */
export function movieScheduleByBrand(movieId, brandId, level) {
  return request.get(`/platform/movie/${movieId}/brand/${brandId}/play_info?${Qs.stringify({level})}`, );
}

/**
 * 影片实收票房
 */
export function movieIncome(movieId) {
  return request.get(`/platform/movie/${movieId}/income`);
}

/**
 * 影片放映信息
 */
export function moviePayInfo(movieId) {
  return request.get(`/platform/movie/${movieId}/play_info`);
}

/**
 * 修改上映时间
 */
export function movieEditTime(movieId, data) {
  return request.post(`/platform/movie/${movieId}/play_time`, data);
}

/**
 * 影片暂停
 */
export function movieShowPause(movieId) {
  return request.post(`/platform/movie/${movieId}/show/pause`);
}

/**
 * 影片暂停
 */
export function movieShowResume(movieId) {
  return request.post(`/platform/movie/${movieId}/show/resume`);
}

/**
 * 获取属性标签
 */
export function getTag() {
  return request.get(`/platform/movie/tags`);
}

/**
 * 修改影片标签属性
 */
export function movieEditTag(movieId, data) {
  return request.post(`/platform/movie/${movieId}/tags`, data);
}

/**
 * 影片总观影人次
 */
export function movieViewTimes(movieId) {
  return request.get(`/platform/movie/${movieId}/view/times`);
}


/**
 * 获取可用的影片制式列表
 */
export function movieFormats() {
  return request.get(`/platform/movie/formats`);
}

/**
 * 获取影片类型
 */
export function movieTypes() {
  return request.get(`/platform/movie/types`);
}

/**
 * 根据影片名模糊查找影片id和影片名
 */
export function movieSearchByName(name) {
  return request.get(`/platform/movie/names?name=${name}`);
}

/**
 * 溢价列表
 */
export function movieOverflowPriceList() {
  return request.get(`/platform/movie/overflow_price`);
}

/**
 * 修改溢价
 */
export function movieOverflowPriceEdit(data) {
  return request.post(`/platform/movie/overflow_price`, data);
}

/**
 * 票价列表
 */
export function moviePlayPriceList(params) {
  return request.get(`/platform/movie/play/price?${Qs.stringify(params)}`);
}

/**
 * 修改票价
 */
export function moviePriceEdit(playId, data) {
  return request.post(`/platform/movie/play/${playId}/price`, data);
}

/**
 * 观影列表
 */
export function movieViewList(params) {
  return request.get(`/platform/movie/view?${Qs.stringify(params)}`);
}

/**
 * 观影详情
 */
export function movieViewDetail(movieId, params) {
  return request.get(`/platform/movie/view/${movieId}/detail?${Qs.stringify(params)}`);
}

export const uploadPostUrl = '/platform/movie/poster/upload';